package com.example.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "teacher_index")
public class Teacher implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private Integer id;
    @Field(type = FieldType.Keyword)
    private String name;
    @Field(type = FieldType.Text)
    private String school;
    @Field(type = FieldType.Text)
    private String course;

    public static Teacher getInstance(int id, String name, String school, String course) {
        return new Teacher(id, name, school, course);
    }

    public static Teacher getInstance(String name, String school, String course) {
        return new Teacher(null, name, school, course);
    }

}
